﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Media;

namespace Alarm0002
{

    public partial class Form1 : Form
    {
        SoundPlayer sound = new SoundPlayer("C:/Windows/Media/ringout.wav");

        public Form1()
        {
            InitializeComponent();
        }

        private void tHoraAtual_Tick(object sender, EventArgs e)
        {
            lbHoraAtual.Text = DateTime.Now.Hour.ToString("00") + ":" + DateTime.Now.Minute.ToString("00") + ":" + DateTime.Now.Second.ToString("00");
        }

        private void btAtivar_Click(object sender, EventArgs e)
        {
            lbHoraProgramada.Text = mtbSetarHora.Text; //label recebe valor do teclado
            mtbSetarHora.Text = ""; //limpa input
            tHoraDespertar.Start();
        }

        private void btParar_Click(object sender, EventArgs e)
        {
            //mPlayer.Ctlcontrols.stop();//para som alarme
            tHoraDespertar.Stop();
            sound.Stop();
        }


        private void tHoraDespertar_Tick(object sender, EventArgs e)
        {
            if (lbHoraAtual.Text == lbHoraProgramada.Text)
            {
                sound.PlayLooping();
            }
        }



    }
}
